"""
@version:python3
@author:ll
@file:作业2 基于seek控制指针的移动.py
@time:2022/1/19 19:51
"""
with open("a.txt",mode="a+b") as f:
    f.seek(-3,2)
    print(f.read().decode("utf-8"))

with open("a.txt", mode="r+b") as f:
    f.seek(3, 0)
    print(f.read().decode("utf-8"))

with open("b.txt",mode="w+b") as f:
    f.write(b"666")
    f.seek(-3,2)
    print(f.read().decode("utf-8"))